package com.wyd.resourcetj.dao;

import javax.transaction.Transactional;

import com.wyd.resourcetj.model.Read_Room;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * IRead_RoomDao
 */
public interface IRead_RoomDao extends JpaRepository<Read_Room, Integer>,JpaSpecificationExecutor<Read_Room>{


    @Transactional
    @Modifying
   // @Query("update Users u set u.uname = ?2 where u.uid= ?1")  示例
    @Query("update Read_Room r set r.name = :name,r.remark = :remark where r.id= :id")
    int editRead_Room(Integer id,String name,String remark);

   /*  @Transactional      //逻辑删除
    @Modifying
   // @Query("update Users u set u.uname = ?2 where u.uid= ?1")  示例
    @Query("update Read_Room r set r.exist = :exist where r.id= :id")
    
    int deleteRead_Room(Integer id,Integer exist); */



    @Transactional
    @Modifying
    @Query("select  r from  Read_Room r where r.rid= :rid")  

    
    
    Read_Room findOne(Integer rid );

    
}